const  CryptoJS = require('crypto-js');
var _key = CryptoJS.MD5('c058579161250b3748dce77cf43eb6c3APP137').toString();
var _iv = '0000000000000000';
 function strToUtf8Bytes(str) {
  const utf8 = [];
  for (let ii = 0; ii < str.length; ii++) {
    let charCode = str.charCodeAt(ii);
    if (charCode < 0x80) utf8.push(charCode);
    else if (charCode < 0x800) {
      utf8.push(0xc0 | (charCode >> 6), 0x80 | (charCode & 0x3f));
    } else if (charCode < 0xd800 || charCode >= 0xe000) {
      utf8.push(0xe0 | (charCode >> 12), 0x80 | ((charCode >> 6) & 0x3f), 0x80 | (charCode & 0x3f));
    } else {
      ii++;
      // Surrogate pair:
      // UTF-16 encodes 0x10000-0x10FFFF by subtracting 0x10000 and
      // splitting the 20 bits of 0x0-0xFFFFF into two halves
      charCode = 0x10000 + (((charCode & 0x3ff) << 10) | (str.charCodeAt(ii) & 0x3ff));
      utf8.push(
        0xf0 | (charCode >> 18),
        0x80 | ((charCode >> 12) & 0x3f),
        0x80 | ((charCode >> 6) & 0x3f),
        0x80 | (charCode & 0x3f),
      );
    }
  }
  //兼容汉字，ASCII码表最大的值为127，大于127的值为特殊字符
  for(let jj=0;jj<utf8.length;jj++){
	  var code = utf8[jj];
	  if(code>127){
		  utf8[jj] = code - 256;
	  }
  }
  return utf8;
}
function encryptByDES(pw) {
    var keyHex = CryptoJS.enc.Utf8.parse(_key);
    pw = CryptoJS.enc.Utf8.parse(pw);
    var encrypted = CryptoJS.AES.encrypt(pw, keyHex, {
        iv: CryptoJS.enc.Utf8.parse(_iv),
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.Pkcs7
    });
    return encrypted.toString();
}
// UwLkbY6tLGq4wdeefhawfw==   wz123123
console.log(encryptByDES('wz123123'))